<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
import axios from "axios";
import qs from "qs";

export default {
  name: 'App',
  // created () {
  // 	if ( this.$cookie.get ( 'id' ) ) {
  // 		this.$store.commit ( 'partnerId', this.$cookie.get ( 'id' ));
  //     axios({
  //       method: 'post',
  //       url:`${this.$store.state.url}/sysPermission/selectByEmployeeId`,
  //       data:qs.stringify({
  //         empId: this.$cookie.get('pid')
  //       })
  //     }).then(res => {
  //       // let arr = res.data.data;
  //       this.$store.state.employ = res.data.data;
  //     });
  // 	}
  // },
  mounted: function() {
    // if ( this.$cookie.get ( 'id' ) ) {
  	// 	this.$store.commit ( 'partnerId', this.$cookie.get ( 'id' ));
    //   axios({
    //     method: 'post',
    //     url:`${this.$store.state.url}/sysPermission/selectByEmployeeId`,
    //     data:qs.stringify({
    //       empId: this.$cookie.get('pid')
    //     })
    //   }).then(res => {
    //     // let arr = res.data.data;
    //     this.$store.state.employ = res.data.data;
    //   });
    // }
    
    switch (this.$route.name) {
      case "store":
        this.navbg = 0;
        break;
      case "userMan":
        this.navbg = 1;
        this.$router.push({
        path: "/main/userMan"
      });
        break;
      case "activity":
        this.navbg = 2;
        this.$router.push({
        path: "/main/activity"
      });
        break;
        case "finance":
        this.navbg = 3;
        this.$router.push({
        path: "/main/finance"
      });
        break;
        
    }
  },
  watch: {
  	$route () {
  		if ( !this.$cookie.get ( 'pid' )) {
  			this.$router.push ( '/' );
  		}
  	}
  }
}
</script>

<style>
html,body{
  margin: 0;
  padding: 0;
}
#app {
  /* min-width: 1600px; */
}
</style>
